<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<link href="<%=basePath%>admin/js/uploadify/css/default.css" rel="stylesheet" type="text/css" />  
<link href="<%=basePath%>admin/js/uploadify/css/uploadify.css" rel="stylesheet" type="text/css" />
<div class="uploadX">
	<input type="hidden" value="<%=basePath %>" id="basePaths"/>
	<input type="hidden" value="<%=session.getAttribute("adminId") %>" id="userId" />
	  <h2 class="title">
	<label>上传文件</label>
	</h2>
	<div class="inputLabel">
		<input type="file" name="file" id="file"  class="text" />
	</div>
	
	<div class="btnAction btnStrong" id="closeUpload" style="float:right" onclick="closeDialog()">
		<input type="button" value="关闭">
	</div>
	<div class="btnAction btnStrong" onclick="javascript:$('#file').uploadifyUpload();" style="float:right">
		<input type="button" value="开始上传"/>
	</div>

</div>
<script type="text/javascript" src="<%=basePath%>admin/js/uploadify/scripts/jquery.uploadify.v2.1.0.min.js"></script>
<script type="text/javascript" src="<%=basePath%>admin/js/uploadify/scripts/swfobject.js"></script>  
<script type="text/javascript">
var basePath = $("#basePaths").val();
var userId = $("#userId").val();
var param = userId;
var $parDoc=$(parent.window.frames['mainFrame'].document);
$("#file").uploadify({ 
    /*注意前面需要书写path的代码*/ 
    'uploader'       : basePath + '/admin/js/uploadify/scripts/uploadify.swf', 
    'script'         : 'uploadFile.action?param=' + param, 
    'cancelImg'      : basePath + '/admin/js/uploadify/cancel.png',
    'fileDataName'   : 'file', //和以下input的name属性一致 
    'auto'           : false, //是否自动开始 
    'multi'          : true, //是否支持多文件上传 
    'buttonText'     : 'Upload', //按钮上的文字 
    'sizeLimit'      : 209715200, //设置单个文件大小限制 
    'fileDesc'       : '支持格式:txt,doc,docx,xls,xlsx,ppt,pptx,pdf,jpg,gif,png,rar,zip.', //如果配置了以下的'fileExt'属性，那么这个属性是必须的 
    'fileExt'        : '*.txt;*.doc;*.docx;*.xls;*.xlsx;*.ppt;*.pptx;*.pdf;*.jpg;*.gif;*.png;*.rar;*.zip',//允许的格式   
    'simUploadLimit' : 3,
    'wmode'          : 'transparent',
	'onAllComplete' : function(event, data){
							$('.xq_dag').remove();
				        	$('#overlay').remove();
				        	$parDoc.find('div.listProduct').simplePage({
				        		width: ['5%', '5%'],
				        		url: 'getFileList.action'
				        	});
					   }
});
var closeDialog=function(){
	$('.xq_dag').remove();
	$('#overlay').remove();
};
</script>
